package task

import (
	"GoPro/Server/msgProto"
	"GoPro/Server/mynet"
	"encoding/binary"
)

type LeaveRoomRouter struct {
}

func (msg *LeaveRoomRouter) PreHandler(req mynet.IRequest) bool {
	_, ok := req.GetServer().OnlineUser[req.GetIConnection()]
	if ok {
		header := msgProto.MsgHeader{}
		header.MsgType = 400
		header.MsgSize = 0
		binary.Write(req.GetIConnection().GetWriter(), binary.BigEndian, header)
		return false
	}
	return true
}

func (msg *LeaveRoomRouter) Handler(req mynet.IRequest) bool {

	return true
}

func (msg *LeaveRoomRouter) PostHandler(req mynet.IRequest) bool {
	return true
}
